<template>
  <div class="mzhzyy">
    <div class="query">
      <div>
        <!-- <span>管理单位：</span> -->
        <!-- <el-cascader
          size="small"
          @change="org_change"
          :options="jigou_1"
          :props="{
            label: 'Name',
            value: 'Id',
            children: 'Children',
            checkStrictly: true,
          }"
          clearable
        ></el-cascader> -->
        <!-- <span style="display: inline-block; margin-left: 8px">责任医生：</span>
        <el-input
          size="small"
          v-model="query.doctorName"
          style="width: 200px"
        ></el-input> -->
        <span style="display: inline-block; margin-left: 8px">查询时间：</span>
        <el-date-picker
          v-model="query.time"
          size="small"
          @change="time_change"
          type="daterange"
          range-separator="至"
          value-format="yyyy-MM-dd"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
        <el-button size="small" @click="getData" style="margin-left: 10px"
          >查询</el-button
        >
        <el-button size="small" @click="getData">刷新</el-button>
      </div>
    </div>
    <div class="main">
      <el-table
        :data="tableData"
        v-loading="isLoading"
        border
        style="width: 100%"
        :header-cell-style="{
          color: '#000',
          backgroundColor: 'rgb(157,201,210)',
          fontFamily: 'FangSong',
        }"
      >
        <el-table-column align="center" label="患者姓名" prop="患者姓名">
        </el-table-column>
        <el-table-column align="center" label="性别" prop="性别">
        </el-table-column>
        <el-table-column align="center" label="患者手机号" prop="手机号">
        </el-table-column>
        <el-table-column align="center" label="科室名称" prop="科室">
        </el-table-column>
        <el-table-column align="center" label="医生姓名" prop="医生姓名">
        </el-table-column>
        <el-table-column align="center" label="预约日期" prop="预约日期">
        </el-table-column>
        <el-table-column align="center" label="预约时间" prop="预约时间">
        </el-table-column>
        <el-table-column align="center" label="预约途径" prop="预约途径">
        </el-table-column>
        <el-table-column align="center" label="预约状态" prop="预约状态">
        </el-table-column>
      </el-table>
    </div>
    <div class="page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.currentPage"
        :page-sizes="[15, 20, 50, 100]"
        :page-size="page.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      query: {
        orgId: 0,
        status: "0",
        signStatus: "-1",
        gender: "-1",
        ageType: "-1",
        bodyCheck: "-1",
        name: "",
        idCard: "",
      },
      page: {
        currentPage: 1,
        pageSize: 15,
        total: 1,
      },
      tableData: [],
      option_1: [],
      option_2: [],
      option_3: [],
      option: {},
      isLoading: false,
      jigou_1: [],
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      this.isLoading = true;
      var body = {
        currentPage: this.page.currentPage,
        pageSize: this.page.pageSize,
        filter: {
          orgId: "3168",
          startTime: this.query.startTime,
          endTime: this.query.endTime,
        },
      };
      this.$post("/Data/OutpatientPatientReservation", body).then((res) => {
        this.isLoading = false;
        if (res.StatusCode != 200) {
          this.$notify.error({
            title: "错误",
            message: res.Errors,
          });
        }
        this.tableData = res.Data.PageList;
        this.page.total = res.Data.Total;
      });
    },
    getJg() {
      this.$get(baseUrl.mbIp + "/api/NPatient/GetOrganTree").then((res) => {
        this.jigou_1 = res.Data;
      });
    },
    org_change(val) {
      this.query.orgId = val[val.length - 1];
    },
    get_list() {
      var data = {
        currentPage: this.page.currentPage,
        pageSize: this.page.pageSize,
        filter: this.query,
      };
      this.isLoading = true;
      this.$post(baseUrl.mbIp + "/api/Data/GetGluStandingBook", data)
        .then((res) => {
          this.isLoading = false;
          if (res.StatusCode != 200) {
            this.$notify.error({
              title: "错误",
              message: res.Errors,
            });
          }
          this.tableData = res.Data.PageList;
          this.page.total = res.Data.Total;
        })
        .catch((err) => {
          this.isLoading = false;
        });
    },
    time_change() {
      this.query.startTime = this.query.time[0];
      this.query.endTime = this.query.time[1];
    },
    handleSizeChange(val) {
      this.page.pageSize = val;
      this.getData();
    },
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.getData();
    },
  },
};
</script>

<style scoped lang="scss">
.mzhzyy {
  background-color: #fff;
  height: calc(100vh - 46px);
  padding: 15px;
  .main {
    margin-top: 10px;
  }

  .page {
    text-align: right;
    margin-top: 15px;
  }
}
</style>